﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Common;
using System.Data;
using System.IO;
using System.Net;
using System.Text;

public partial class SiteMaster : System.Web.UI.MasterPage
{
   // DatabaseHelper DB = new DatabaseHelper();
    protected static DataTable dt;
    protected void Page_Load(object sender, EventArgs e)
    {
        

       // string myIp = Request.UserHostAddress;
        //Label1.Text = myIp;
    }
    
   
   /* protected void lblDownload_Click(object sender, EventArgs e)
    {
        dt = DB.ExecuteDataTable("Config_DownloadFile", CommandType.StoredProcedure, ConnectionState.CloseOnExit);
        Byte[] bytes = (Byte[])dt.Rows[0]["Data"];
        Response.Buffer = true;
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = dt.Rows[0]["ContentType"].ToString();
        Response.AddHeader("content-disposition", "attachment;filename="
        + dt.Rows[0]["Name"].ToString());
        Response.BinaryWrite(bytes);
        Response.Flush();
        Response.End();
    }*/
    protected void lbtThoat_Click(object sender, EventArgs e)
    {
        //string host = Dns.GetHostName();
        //IPHostEntry ip = Dns.GetHostEntry(host);
        //string CacheIP = ip.AddressList[2].ToString();
        Session["countLoginFail"] = 0;

        if (Session["UserName"] != null)
        {
            string UserName = Session["UserName"].ToString();
            Cache.Remove(UserName);
        }
    
    
        //Cache.Remove(CacheIP);
        Session["isLogin"] = null;
        Session["UserName"] = null;
        Session["countLoginFail"] = null;
        Session["RoleID"] = null;
        Session["Email"] = null;
        Session.RemoveAll();
        Response.Redirect("~/Default.aspx");
    }
}
